<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            padding-bottom: 800px;
            padding-left: 30px;
        }
        .avd-box{
            --w:1200px;
            width: var(--w);
            display: flex;
            flex-flow: row nowrap;
            box-shadow: 0 0 10px #999;
        }
        .avd-box .item{
            width: calc( var(--w)/6 );
            height: 266px;
            border: 1px solid #dedede;
            background-color: white;
            padding: 16px;
            box-sizing: border-box;
            cursor: pointer;
            user-select: none;
            transition: all 600ms ease;
        }
        .avd-box .info{
            color: #333;
            text-align: center;
        }
        .avd-box .title{
            font-size: 20px;
        }
        .avd-box .desc{
            font-size: 14px;
        }
        .avd-box .img{
            width: calc( var(--w)/6-32px );
            height: 100%;
            transition: all 600ms ease;
        }
        .avd-box img{
            width: 100%;
            height: 100%;
            object-fit: scale-down;
            transition: all 600ms ease;
        }
        
        .avd-box .item.active{
            width: calc( (100%/6)*2 );
            background-color: #3288e6;
        }
        .avd-box .item.active .info{
            color: white;
            text-align: left;
        }
        .avd-box .item.active .img{
            margin-left: 50%;
        }
        .avd-box .item.active img{
            transform: scale(1.3) translate(-8%,-4%);
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 
            css BFC 概念
                衍生的html标签结构布局模式 - BFC布局模式
        -->
        <div class="avd-box">
            <div :class=" activeIndex==1?'item active':'item' " @click="selectItem(1)">
                <div class="info">
                    <div class="title">游戏手机</div>
                    <div class="desc">游戏手机游戏手机游戏</div>
                </div>
                <div class="img">
                    <img src="../assets/img/1.png" alt="" srcset="">
                </div>
            </div>
            <div :class=" activeIndex==2?'item active':'item' " @click="selectItem(2)">
                <div class="info">
                    <div class="title">游戏手机</div>
                    <div class="desc">游戏手机游戏手机游戏</div>
                </div>
                <div class="img">
                    <img src="../assets/img/2.png" alt="" srcset="">
                </div>
            </div>
            <div :class=" activeIndex==3?'item active':'item' " @click="selectItem(3)">
                <div class="info">
                    <div class="title">游戏手机</div>
                    <div class="desc">游戏手机游戏手机游戏</div>
                </div>
                <div class="img">
                    <img src="../assets/img/3.png" alt="" srcset="">
                </div>
            </div>
            <div :class=" activeIndex==4?'item active':'item' " @click="selectItem(4)">
                <div class="info">
                    <div class="title">游戏手机</div>
                    <div class="desc">游戏手机游戏手机游戏</div>
                </div>
                <div class="img">
                    <img src="../assets/img/4.png" alt="" srcset="">
                </div>
            </div>
            <div :class=" activeIndex==5?'item active':'item' " @click="selectItem(5)">
                <div class="info">
                    <div class="title">游戏手机</div>
                    <div class="desc">游戏手机游戏手机游戏</div>
                </div>
                <div class="img">
                    <img src="../assets/img/5.png" alt="" srcset="">
                </div>
            </div>
        </div>

    </div>
    <script type="module">
        // 加载 Vue3 的ESM 模块文件
        import { createApp } from "../assets/vue3/vue.esm-browser.js"
        createApp({
            data(){
                return {
                    activeIndex:3
                }
            },
            methods:{
                selectItem(activeIndex){
                    this.activeIndex = activeIndex;
                }
            }
        }).mount("#app")
    </script>
</body>
</html>